package com.ase.redislike.common.result;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author： yuhang
 * @Date： 2021/11/9
 * @Description：返回结果状态封装
 */
public class CommonResult {

    public static Response success(Object data) {
        Response<Object> response = new Response<>();
        response.setCode(Status.SUCCESS.getCode());
        response.setMsg(Status.SUCCESS.getMsg());
        response.setData(data);
        return response;
    }

    public static Response failure(Object data) {
        Response<Object> response = new Response<>();
        response.setCode(Status.FAILURE.getCode());
        response.setMsg(Status.FAILURE.getMsg());
        response.setData(data);
        return response;
    }
    public static Response successCustomize(Object data,String msg) {
        Response<Object> response = new Response<>();
        response.setCode(Status.SUCCESS.getCode());
        response.setMsg(msg);
        response.setData(data);
        return response;
    }

    public static Response failureCustomize(Object data,String msg) {
        Response<Object> response = new Response<>();
        response.setCode(Status.FAILURE.getCode());
        response.setMsg(msg);
        response.setData(data);
        return response;
    }

}
